﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LdapSkupineSeznam.aspx.cs" Inherits="Sio.Mdm.Web.Instalacija.LdapSkupineSeznam" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    
    <script type="text/javascript">

        function PrepareParamsAndShowDialog(eventId, grid, dialog) {

            if (eventId == 'Import') {
                dialog.show();
            }            
        }
        
        function getSelectedStreznikID(grid) {            
            if (grid.getSelectionModel().selections.length == 1) {
                var id = grid.getSelectionModel().selections.items[0].id;
                return id;
            }
            else { return 0; }
        }
        
        var LdapTipiRenderer = function(value) {
            var r = StoreLdapTipi.getById(value);
            if (Ext.isEmpty(r)) { return ""; }
            return r.data.Naziv;
        };

        function setButtons() {
            btnRemove.setDisabled(false);
            btnPreveriPripadnost.setDisabled(false);            
        }
    </script>
    
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    
    <ext:Viewport ID="Viewport1" runat="server" Layout="Fit">
    <Content>
        <sio:GridPanel ID="GridSkupineSeznam" runat="server" StripeRows="true" TrackMouseOver="true" AutoExpandColumn="SkupinaNaziv">                
                <Store>
                    <ext:Store ID="StoreSkupineSeznam" runat="server">
                        <Reader>
                            <ext:JsonReader IDProperty="SkupinaID">
                                <Fields>
                                    <ext:RecordField Name="SkupinaID" Type="Int" />
                                    <ext:RecordField Name="StoritevID" Type="Int" />
                                    <ext:RecordField Name="SkupinaNaziv" Type="String" />
                                    <ext:RecordField Name="StoritevNaziv" Type="String" /> 
                                    <ext:RecordField Name="StreznikIme" Type="String" />
                                    <ext:RecordField Name="StreznikOpis" Type="String" />
                                    <ext:RecordField Name="StreznikNaslov" Type="String" />    
                                    <ext:RecordField Name="StoritevParam" Type="String" />                                                                                                                                  
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>
                </Store>
                    <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:RowNumbererColumn />
                        <ext:Column ColumnID="SkupinaID" Hidden="true" Hideable="false" DataIndex="SkupinaID" Header="SkupinaID">
                        </ext:Column>
                        <ext:Column ColumnID="StoritevID" Hidden="true" Hideable="false" DataIndex="StoritevID" Header="StoritevID">
                        </ext:Column>
                        <ext:Column ColumnID="SkupinaNaziv" Hidden="false" Hideable="false" DataIndex="SkupinaNaziv" Header="Skupina">
                        </ext:Column>                        
                        <ext:Column ColumnID="StoritevNaziv" Hidden="false" Hideable="false" DataIndex="StoritevNaziv" Header="Storitev" Width="150">
                        </ext:Column>    
                        <ext:Column ColumnID="StreznikIme" Hidden="false" Hideable="false" DataIndex="StreznikIme" Header="Streznik" Width="120">
                        </ext:Column>   
                        <ext:Column ColumnID="StoritevParam" Hidden="false" Hideable="false" DataIndex="StoritevParam" Header="Param" Width="300">
                        </ext:Column>                            
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server">                    
						<Listeners>
							<RowSelect Handler="setButtons();" />
						</Listeners>
					</ext:RowSelectionModel>
                </SelectionModel>
                <TopBar>
                <ext:Toolbar ID="Toolbar1" runat="server">
                <Items>
                    <sio:Button runat="server" ID="Uvoz" Text="Uvoz podatkov" Icon="Add">                                
                        <Listeners>
                            <Click Handler="PrepareParamsAndShowDialog('Import',#{GridSkupineSeznam},#{DialogSkupineUvoz});" />
                        </Listeners>
                    </sio:Button>                    
                    <sio:Button runat="server" ID="btnRemove" Text="Odstrani" Icon="Delete" Disabled="true">
                        <DirectEvents>
                            <Click OnEvent="OdstraniZapise">
                                <Confirmation ConfirmRequest="true" Message="Odstranim izbrane zapise?" />
                                <ExtraParams>
                                    <ext:Parameter Name="selected" Mode="Raw" Value="Ext.encode(#{GridSkupineSeznam}.getRowsValues({selectedOnly:true}))" />
                                </ExtraParams>
                            </Click>
                        </DirectEvents>
                    </sio:Button> 
                    <ext:ToolbarSeparator />
                    <sio:Button runat="server" ID="btnPreveriPripadnost" Text="Preveri pripadnost" Icon="AsteriskYellow" Disabled="true">
                        <DirectEvents>
                            <Click OnEvent="PreveriPripadnost">
                                <ExtraParams>
                                    <ext:Parameter Name="selected" Mode="Raw" Value="Ext.encode(#{GridSkupineSeznam}.getRowsValues({selectedOnly:true}))" />    
                                </ExtraParams>    
                            </Click>    
                        </DirectEvents>
                    </sio:Button>                                       
                 </Items>
                </ext:Toolbar>
                </TopBar>
         </sio:GridPanel>
    
    </Content>
    </ext:Viewport>
    
    <sio:Dialog runat="server" ID="DialogSkupineUvoz"
		Width="700"
		Height="500"
		Url="LdapSkupineUvoz.aspx"
		DialogButtons="Close"
    Title="Skupine uvoz">
        <Parameters>			
			<ext:Parameter Name="OrgarnizacijaID" Value="-1" Mode="Value" />
		</Parameters>
		<Listeners>
            <Hide Handler="#{StoreSkupineSeznam}.reload();" />
        </Listeners>
	</sio:Dialog>
    
    </form>
</body>
</html>
